/**
 *                            License
 * THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS  
 * CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). 
 * THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.  
 * ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR  
 * COPYRIGHT LAW IS PROHIBITED.
 * 
 * BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND  
 * AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE  
 * MAY BE CONSIDERED TO BE A CONTRACT,
 * THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED 
 * HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
 * 
 */
package com.lineage.server.model.item.etcitem.action;

import com.lineage.server.PacketCreate;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.model.item.ItemExecutor;

/**
 * Class <code>StickybackLogbook_1_8</code> 涂着胶水的航海日志：１～８页.<br>
 * 涂着胶水的航海日志：１页 - 41048 <br>
 * 涂着胶水的航海日志：２页 - 41049 <br>
 * 涂着胶水的航海日志：３页 - 41050 <br>
 * 涂着胶水的航海日志：４页 - 41051 <br>
 * 涂着胶水的航海日志：５页 - 41052 <br>
 * 涂着胶水的航海日志：６页 - 41053 <br>
 * 涂着胶水的航海日志：７页 - 41054 <br>
 * 涂着胶水的航海日志：８页 - 41055 <br>
 * 
 * @author jrwz
 * @version 2012-6-19下午12:12:07
 * @see com.lineage.server.model.item.etcitem.action
 * @since JDK1.7
 */
public final class StickybackLogbook_1_8 extends ItemExecutor {

    /**
     * 取得实例.
     * 
     * @return 实例
     */
    public static ItemExecutor get() {
        return new StickybackLogbook_1_8();
    }

    /** 涂着胶水的航海日志：１～８页. */
    private StickybackLogbook_1_8() {
    }

    @Override
    public void execute(final L1PcInstance pc, final L1ItemInstance useItem,
            final int readC1, final int readC2, final int targetId,
            final int targetX, final int targetY) {
        final int itemId = useItem.getItemId();
        final int itemobj = targetId;
        final L1ItemInstance l1iteminstance1 = pc.getInventory().getItem(
                itemobj);
        final int logbookId = l1iteminstance1.getItem().getItemId();

        if (logbookId == (itemId + 8034)) {
            pc.createNewItem(pc, logbookId + 2, 1);
            pc.getInventory().removeItem(l1iteminstance1, 1);
            pc.getInventory().removeItem(useItem, 1);
        } else {
            PacketCreate.get().sendSinglePackets(pc, "没有任何事情发生");
        }
    }
}
